<?php

namespace App\Filament\Resources\Users\Schemas;

use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Schemas\Schema;

class UserForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('name')
                    ->label('姓名')
                    ->required(),
                TextInput::make('email')
                    ->label('邮箱')
                    ->email()
                    ->required(),
                TextInput::make('username')
                    ->label('用户名')
                    ->required(),
                DateTimePicker::make('email_verified_at')
                    ->label('邮箱验证时间'),
                TextInput::make('password')
                    ->label('密码')
                    ->password()
                    ->required(),
                TextInput::make('avatar')
                    ->label('头像'),
                Textarea::make('bio')
                    ->label('简介')
                    ->columnSpanFull(),
                Select::make('role')
                    ->label('角色')
                    ->options(['admin' => '管理员', 'editor' => '编辑', 'author' => '作者', 'user' => '用户'])
                    ->default('user')
                    ->required(),
                Select::make('status')
                    ->label('状态')
                    ->options(['active' => '活跃', 'inactive' => '未激活', 'banned' => '已封禁'])
                    ->default('active')
                    ->required(),
                DateTimePicker::make('last_login_at')
                    ->label('最后登录时间'),
            ]);
    }
}
